﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using jnlamp.DBUtility;//Please add references
namespace jnlamp.DAL
{
	/// <summary>
	/// 数据访问类:devinfo
	/// </summary>
	public partial class devinfo
	{
		public devinfo()
		{}
		#region  BasicMethod

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
		return DbHelperSQL.GetMaxID("KeyId", "devinfo"); 
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int KeyId)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from devinfo");
			strSql.Append(" where KeyId=@KeyId");
			SqlParameter[] parameters = {
					new SqlParameter("@KeyId", SqlDbType.Int,4)
			};
			parameters[0].Value = KeyId;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(jnlamp.Model.devinfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into devinfo(");
			strSql.Append("DevType,DevID,devname,DevLocation,DevOwnerName,DevOwnerID,DevContact,XQHID,chn0,chn1,chn2,chn3,mjd,mwd,mdatetime,mmark,mpic,changedatetime,yjd,ywd,yhb)");
			strSql.Append(" values (");
            strSql.Append("@DevType,@DevID,@devname,@DevLocation,@DevOwnerName,@DevOwnerID,@DevContact,@XQHID,@chn0,@chn1,@chn2,@chn3,@mjd,@mwd,@mdatetime,@mmark,@mpic,@changedatetime,@yjd,@ywd,@yhb)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@DevType", SqlDbType.VarChar,50),
					new SqlParameter("@DevID", SqlDbType.VarChar,30),
					new SqlParameter("@devname", SqlDbType.NVarChar,50),
					new SqlParameter("@DevLocation", SqlDbType.VarChar,50),
					new SqlParameter("@DevOwnerName", SqlDbType.VarChar,50),
					new SqlParameter("@DevOwnerID", SqlDbType.VarChar,20),
					new SqlParameter("@DevContact", SqlDbType.VarChar,50),
					new SqlParameter("@XQHID", SqlDbType.VarChar,100),
					new SqlParameter("@chn0", SqlDbType.NVarChar,20),
					new SqlParameter("@chn1", SqlDbType.NVarChar,20),
					new SqlParameter("@chn2", SqlDbType.NVarChar,20),
					new SqlParameter("@chn3", SqlDbType.NVarChar,20),
					new SqlParameter("@mjd", SqlDbType.Decimal,9),
					new SqlParameter("@mwd", SqlDbType.Decimal,9),
					new SqlParameter("@mdatetime", SqlDbType.SmallDateTime),
					new SqlParameter("@mmark", SqlDbType.Text),
					new SqlParameter("@mpic", SqlDbType.NVarChar,250),
                                        new SqlParameter("@changedatetime", SqlDbType.SmallDateTime),
                                        new SqlParameter("@yjd", SqlDbType.NVarChar,20),
                                        new SqlParameter("@ywd", SqlDbType.NVarChar,20),
                                        new SqlParameter("@yhb", SqlDbType.NVarChar,20)};
			parameters[0].Value = model.DevType;
			parameters[1].Value = model.DevID;
			parameters[2].Value = model.devname;
			parameters[3].Value = model.DevLocation;
			parameters[4].Value = model.DevOwnerName;
			parameters[5].Value = model.DevOwnerID;
			parameters[6].Value = model.DevContact;
			parameters[7].Value = model.XQHID;
			parameters[8].Value = model.chn0;
			parameters[9].Value = model.chn1;
			parameters[10].Value = model.chn2;
			parameters[11].Value = model.chn3;
			parameters[12].Value = model.mjd;
			parameters[13].Value = model.mwd;
			parameters[14].Value = model.mdatetime;
			parameters[15].Value = model.mmark;
			parameters[16].Value = model.mpic;
            parameters[17].Value = model.changedatetime;
            parameters[18].Value = model.yjd;
            parameters[19].Value = model.ywd;
            parameters[20].Value = model.yhb;
			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(jnlamp.Model.devinfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update devinfo set ");
			strSql.Append("DevType=@DevType,");
			strSql.Append("DevID=@DevID,");
			strSql.Append("devname=@devname,");
			strSql.Append("DevLocation=@DevLocation,");
			strSql.Append("DevOwnerName=@DevOwnerName,");
			strSql.Append("DevOwnerID=@DevOwnerID,");
			strSql.Append("DevContact=@DevContact,");
			strSql.Append("XQHID=@XQHID,");
			strSql.Append("chn0=@chn0,");
			strSql.Append("chn1=@chn1,");
			strSql.Append("chn2=@chn2,");
			strSql.Append("chn3=@chn3,");
			strSql.Append("mjd=@mjd,");
			strSql.Append("mwd=@mwd,");			
			strSql.Append("mmark=@mmark,");
			strSql.Append("mpic=@mpic,");
            strSql.Append("yjd=@yjd,");
            strSql.Append("ywd=@ywd,");
            strSql.Append("yhb=@yhb");
			strSql.Append(" where KeyId=@KeyId");
			SqlParameter[] parameters = {
					new SqlParameter("@DevType", SqlDbType.VarChar,50),
					new SqlParameter("@DevID", SqlDbType.VarChar,30),
					new SqlParameter("@devname", SqlDbType.NVarChar,50),
					new SqlParameter("@DevLocation", SqlDbType.VarChar,50),
					new SqlParameter("@DevOwnerName", SqlDbType.VarChar,50),
					new SqlParameter("@DevOwnerID", SqlDbType.VarChar,20),
					new SqlParameter("@DevContact", SqlDbType.VarChar,50),
					new SqlParameter("@XQHID", SqlDbType.VarChar,100),
					new SqlParameter("@chn0", SqlDbType.NVarChar,20),
					new SqlParameter("@chn1", SqlDbType.NVarChar,20),
					new SqlParameter("@chn2", SqlDbType.NVarChar,20),
					new SqlParameter("@chn3", SqlDbType.NVarChar,20),
					new SqlParameter("@mjd", SqlDbType.Decimal,9),
					new SqlParameter("@mwd", SqlDbType.Decimal,9),					
					new SqlParameter("@mmark", SqlDbType.Text),
					new SqlParameter("@mpic", SqlDbType.NVarChar,250),
                     new SqlParameter("@yjd", SqlDbType.NVarChar,20),
                                        new SqlParameter("@ywd", SqlDbType.NVarChar,20),
                                        new SqlParameter("@yhb", SqlDbType.NVarChar,20),
					new SqlParameter("@KeyId", SqlDbType.Int,4)};
			parameters[0].Value = model.DevType;
			parameters[1].Value = model.DevID;
			parameters[2].Value = model.devname;
			parameters[3].Value = model.DevLocation;
			parameters[4].Value = model.DevOwnerName;
			parameters[5].Value = model.DevOwnerID;
			parameters[6].Value = model.DevContact;
			parameters[7].Value = model.XQHID;
			parameters[8].Value = model.chn0;
			parameters[9].Value = model.chn1;
			parameters[10].Value = model.chn2;
			parameters[11].Value = model.chn3;
			parameters[12].Value = model.mjd;
			parameters[13].Value = model.mwd;
			parameters[14].Value = model.mmark;
			parameters[15].Value = model.mpic;
			parameters[16].Value = model.yjd;
            parameters[17].Value = model.ywd;
            parameters[18].Value = model.yhb;
            parameters[19].Value = model.KeyId;	

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
        /// <summary>
        /// 更新设备更换诱蕊时间
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Updateyx(jnlamp.Model.devinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update devinfo set ");
            strSql.Append("changedatetime=@changedatetime");            

            strSql.Append(" where KeyId=@KeyId");
            SqlParameter[] parameters = {					
					new SqlParameter("@changedatetime", SqlDbType.SmallDateTime),									
					new SqlParameter("@KeyId", SqlDbType.Int,4)};
            parameters[0].Value = model.changedatetime;           
            parameters[1].Value = model.KeyId;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新设备参数TSQ的
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Updatecs(jnlamp.Model.devinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update devinfo set ");           
            strSql.Append("chn0=@chn0,");
            strSql.Append("chn1=@chn1,");
            strSql.Append("chn2=@chn2,");
            strSql.Append("XQHID=@XQHID");
            
            strSql.Append(" where KeyId=@KeyId");
            SqlParameter[] parameters = {					
					new SqlParameter("@chn0", SqlDbType.NVarChar,20),
					new SqlParameter("@chn1", SqlDbType.NVarChar,20),
					new SqlParameter("@chn2", SqlDbType.NVarChar,20),
					new SqlParameter("@XQHID", SqlDbType.VarChar,100),
					new SqlParameter("@KeyId", SqlDbType.Int,4)};
            parameters[0].Value = model.chn0;
            parameters[1].Value =  model.chn1;
            parameters[2].Value = model.chn2;
            parameters[3].Value = model.XQHID;
            parameters[4].Value = model.KeyId; 
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int KeyId)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from devinfo ");
			strSql.Append(" where KeyId=@KeyId");
			SqlParameter[] parameters = {
					new SqlParameter("@KeyId", SqlDbType.Int,4)
			};
			parameters[0].Value = KeyId;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string KeyIdlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from devinfo ");
			strSql.Append(" where KeyId in ("+KeyIdlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public jnlamp.Model.devinfo GetModel(int KeyId)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 KeyId,DevType,DevID,devname,DevLocation,DevOwnerName,DevOwnerID,DevContact,XQHID,chn0,chn1,chn2,chn3,mjd,mwd,mdatetime,mmark,mpic from devinfo ");
			strSql.Append(" where KeyId=@KeyId");
			SqlParameter[] parameters = {
					new SqlParameter("@KeyId", SqlDbType.Int,4)
			};
			parameters[0].Value = KeyId;

			jnlamp.Model.devinfo model=new jnlamp.Model.devinfo();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}
        public jnlamp.Model.devinfo GetModel(string devid)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 KeyId,DevType,DevID,devname,DevLocation,DevOwnerName,DevOwnerID,DevContact,XQHID,chn0,chn1,chn2,chn3,mjd,mwd,mdatetime,mmark,mpic from devinfo ");
            strSql.Append(" where DevID=@DevID");
            SqlParameter[] parameters = {
					new SqlParameter("@DevID", SqlDbType.VarChar,30)
			};
            parameters[0].Value = devid;

            jnlamp.Model.devinfo model = new jnlamp.Model.devinfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public jnlamp.Model.devinfo DataRowToModel(DataRow row)
		{
			jnlamp.Model.devinfo model=new jnlamp.Model.devinfo();
			if (row != null)
			{
				if(row["KeyId"]!=null && row["KeyId"].ToString()!="")
				{
					model.KeyId=int.Parse(row["KeyId"].ToString());
				}
				if(row["DevType"]!=null)
				{
					model.DevType=row["DevType"].ToString();
				}
				if(row["DevID"]!=null)
				{
					model.DevID=row["DevID"].ToString();
				}
				if(row["devname"]!=null)
				{
					model.devname=row["devname"].ToString();
				}
				if(row["DevLocation"]!=null)
				{
					model.DevLocation=row["DevLocation"].ToString();
				}
				if(row["DevOwnerName"]!=null)
				{
					model.DevOwnerName=row["DevOwnerName"].ToString();
				}
				if(row["DevOwnerID"]!=null)
				{
					model.DevOwnerID=row["DevOwnerID"].ToString();
				}
				if(row["DevContact"]!=null)
				{
					model.DevContact=row["DevContact"].ToString();
				}
				if(row["XQHID"]!=null)
				{
					model.XQHID=row["XQHID"].ToString();
				}
				if(row["chn0"]!=null)
				{
					model.chn0=row["chn0"].ToString();
				}
				if(row["chn1"]!=null)
				{
					model.chn1=row["chn1"].ToString();
				}
				if(row["chn2"]!=null)
				{
					model.chn2=row["chn2"].ToString();
				}
				if(row["chn3"]!=null)
				{
					model.chn3=row["chn3"].ToString();
				}
				if(row["mjd"]!=null && row["mjd"].ToString()!="")
				{
					model.mjd=decimal.Parse(row["mjd"].ToString());
				}
				if(row["mwd"]!=null && row["mwd"].ToString()!="")
				{
					model.mwd=decimal.Parse(row["mwd"].ToString());
				}
				if(row["mdatetime"]!=null && row["mdatetime"].ToString()!="")
				{
					model.mdatetime=DateTime.Parse(row["mdatetime"].ToString());
				}
				if(row["mmark"]!=null)
				{
					model.mmark=row["mmark"].ToString();
				}
				if(row["mpic"]!=null)
				{
					model.mpic=row["mpic"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select KeyId,DevType,DevID,devname,DevLocation,DevOwnerName,DevOwnerID,DevContact,XQHID,chn0,chn1,chn2,chn3,mjd,mwd,mdatetime,mmark,mpic ");
			strSql.Append(" FROM devinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" KeyId,DevType,DevID,devname,DevLocation,DevOwnerName,DevOwnerID,DevContact,XQHID,chn0,chn1,chn2,chn3,mjd,mwd,mdatetime,mmark,mpic ");
			strSql.Append(" FROM devinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM Vdevinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.KeyId desc");
			}
            strSql.Append(")AS Row, T.*  from Vdevinfo T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "devinfo";
			parameters[1].Value = "KeyId";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  BasicMethod
		#region  ExtensionMethod
        public int Addcbd(string devid,DateTime dt)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into [dbstatus].[dbo].[t_cbdStatus](");
            strSql.Append("[devID],[sta_ch0],[sta_ch1],[sta_ch2],[sta_ch3],[sta_ch4],[sta_ch5],[sta_ch6],[sta_ch7],[updateTime])");
            strSql.Append(" values (");
            strSql.Append("@DevID,'1','1','1','1','1','1','1','1',@updateTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {					
					new SqlParameter("@DevID", SqlDbType.VarChar,30),					
					new SqlParameter("@updateTime", SqlDbType.SmallDateTime)
					};
            parameters[0].Value = devid;
            parameters[1].Value =dt;            
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        public int Addybq(string devid, DateTime dt)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into [dbstatus].[dbo].[t_ybqStatus](");
            strSql.Append("[devID],[ch0],[ch1],[ch2],[ch3],[ch4],[ch5],[ch6],[ch7],[updateTime])");
            strSql.Append(" values (");
            strSql.Append("@DevID,'0','0','0','0','0','0','0','0',@updateTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {					
					new SqlParameter("@DevID", SqlDbType.VarChar,30),					
					new SqlParameter("@updateTime", SqlDbType.SmallDateTime)
					};
            parameters[0].Value = devid;
            parameters[1].Value = dt;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        public DateTime? getMaxcbdtime(string devid)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select max(updateTime) FROM [dbstatus].[dbo].[t_cbdStatus] ");
            strSql.Append(" where devID=@devID");
            SqlParameter[] parameters = {
					new SqlParameter("@devID", SqlDbType.VarChar,30)
			};
            parameters[0].Value = devid;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return null;
            }
            else
            {
                return Convert.ToDateTime(obj);
            }

        }
        public DateTime? getMaxybqtime(string devid)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select max(updateTime) FROM [dbstatus].[dbo].[t_ybqStatus] ");
            strSql.Append(" where devID=@devID");
            SqlParameter[] parameters = {
					new SqlParameter("@devID", SqlDbType.VarChar,30)
			};
            parameters[0].Value = devid;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return null;
            }
            else
            {
                return Convert.ToDateTime(obj);
            }

        }
        public int Addxqh(string devidm,string devids,DateTime dt )
        {
            string mset="";
            mset=getxqhcs(devidm);
            if (mset == getxqhcs(devids))
            {
                mset += ",datetime";                
                DateTime? dts= getMaxxqhtime(devids);
                StringBuilder strSql = new StringBuilder();
                strSql.Append("INSERT INTO [PGData].[dbo].[" + devids + "](" + mset + ") SELECT " + mset + " FROM [PGData].[dbo].[" + devidm + "] where 1=1 ");
                if (dts != null)
                {
                    strSql.Append(" and datetime>'"+dts.Value.ToString()+"'");
                }
                strSql.Append(" and datetime>'" + dt.ToString()+"'");
                object obj = DbHelperSQL.GetSingle(strSql.ToString());
                if (obj == null)
                {
                    return 0;
                }
                else
                {
                    return Convert.ToInt32(obj);
                }
            }
            else
            {
                return 0;
            }
           
        }
        public DateTime? getMaxxqhtime(string devid)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select max(datetime) FROM [PGData].[dbo].[" + devid + "] ");           
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return null;
            }
            else
            {
                return Convert.ToDateTime(obj);
            }

        }
        public string getxqhcs(string devid)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select TD FROM [PGData].[dbo].[PHNUM]");
            strSql.Append(" where deviceid=@devID");
            SqlParameter[] parameters = {
					new SqlParameter("@devID", SqlDbType.VarChar,30)
			};
            parameters[0].Value = devid;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return null;
            }
            else
            {
                return obj.ToString();
            }

        }
		#endregion  ExtensionMethod
	}
}

